﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ServiceModel.DomainServices.Client;

namespace ZJUDTS
{
	public partial class LogOnPanel : UserControl
	{
		Web.ZJUDTS2DomainContext ZjudtsData;
		public LogOnPanel()
		{
			InitializeComponent();
		}

		private void HyperlinkButton_Click_1(object sender, RoutedEventArgs e)
		{
			Content = new Register();
		}

		private void Button_Click_1(object sender, RoutedEventArgs e)
		{
			ZjudtsData = new Web.ZJUDTS2DomainContext();
			LoadOperation<Web.User> loadop=this.ZjudtsData.Load(this.ZjudtsData.GetUserbyNameQuery(Nametype.Text));
			DataGrid.ItemsSource = loadop.Entities;
			if (loadop.Entities.Any(c => c.Password == PasswordType.Password))
				MessageBox.Show("登陆成功！");
			else
				MessageBox.Show("用户名或密码错误！");
		}
			
	}
}
